# coding=utf-8
'''
    author: lm,
    date: 2025-6-dd,
    python version: 3.6
'''
import os
import logging
from logging.handlers import RotatingFileHandler

# 创建一个大小为1KB的循环日志文件处理器
handler = RotatingFileHandler('/home/zb/project_lm/output.log', maxBytes=1024, backupCount=3)
logging.basicConfig(handlers=[handler], level=logging.INFO,
                    format='%(asctime)s:%(levelname)s:%(message)s')

known_face_names = []
known_face_encodings = []
master_photos = []
master_face_encoding = []
def get_file_names_in_folder(folder_path):
    file_names = []
    logging.info('Script started.')
    # 遍历文件夹中的所有文件
    for file_name in os.listdir(folder_path):
        # 获取文件的完整路径
        file_path = os.path.join(folder_path, file_name)
        # 如果是文件而不是文件夹
        if os.path.isfile(file_path):
            # 去除文件类型后缀
            file_name_without_extension = os.path.splitext(file_name)[0]
            # 添加到列表
            file_names.append(file_name_without_extension)
    logging.info('Script finished.')
    return file_names


# 要遍历的文件夹路径
current_dir = os.path.dirname(os.path.abspath(__file__))
folder_path = os.path.join(current_dir,"master_photos")

# 获取文件名列表
known_face_names = get_file_names_in_folder(folder_path)
# print(known_face_names)
